// pages/login/index.js
Page({
  handleGetUserInfo(e){
    console.log(e)
    wx.login({
      success: function (res) {
        wx.request({
          url: 'http://localhost/gym/public/admin/api/setUserInfo',
          method: "POST",
          header: {
            "Content-Type": "application/x-www-form-urlencoded",
          },
          data: {
            userInfo: JSON.stringify(e.detail.userInfo),
            code: res.code,
          },
          success: function (res) {
            console.log(res)
            const { userInfo } = e.detail;
            let user = res.data.message
            wx.setStorageSync("userinfo", userInfo);
            wx.setStorageSync("user", user);
            wx.navigateBack({
              delta: 1
            });
          }
        })
      }
    })
  }
})